xsm/flask: remove page-to-domain lookups from XSM hooks
authorDaniel De Graaf <dgdegra@tycho.nsa.gov>
Wed, 22 Aug 2012 21:14:52 +0000 (22:14 +0100)
committerDaniel De Graaf <dgdegra@tycho.nsa.gov>
Wed, 22 Aug 2012 21:14:52 +0000 (22:14 +0100)
commitc14bb38304d348b2b39160947b772442a15d03fc
treefebba903031e096ae42563e51aaa1baef398a788
parent00e23f230212638718b6ff9214b829a663707a76
xsm/flask: remove page-to-domain lookups from XSM hooks

Doing a reverse lookup from MFN to its owning domain is redundant with
the internal checks Xen does on pages. Change the checks to operate
directly on the domain owning the pages for normal memory; MMIO areas
are still checked with security_iomem_sid.

This fixes a hypervisor crash when a domU attempts to map an MFN that
is free in Xen's heap: the XSM hook is called before the validity
check, and page_get_owner returns garbage when called on these
pages. While explicitly checking for such pages using
page_get_owner_and_reference is a possible solution, this ends up
duplicating parts of get_page_from_l1e.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Committed-by: Keir Fraser <keir@xen.org>
xen/arch/x86/domctl.c
xen/arch/x86/mm.c
xen/include/xsm/xsm.h
xen/xsm/dummy.c
xen/xsm/flask/hooks.c